Ext.BLANK_IMAGE_URL = '/supervise/resources/images/default/s.gif';
Ext.QuickTips.init();
var start = {
	id : 'start-panel',
	title : '欢迎使用',
	layout : 'fit',
	bodyStyle : 'padding:25px',
	html : '<img src="/supervise/images/bg.jpg"/>'
};

var windIndex = 0;
Ext.onReady(function() {
	setTimeout(function() {
		Ext.get('loading').remove();
		Ext.getDom('header').style.visibility = 'visible';
		var vp = new Ext.Viewport({
			layout : 'border',
			defaults : {
				collapsible : true,
				split : true
			},
			items : [{
						// 头部分
						region : 'north',
						xtype : 'box',
						margins : '0 0 0 0',
						// html : '<img src="images/system/top.gif" width="100%"
						// height="100">',
						applyTo : 'header',
						height : 50,
						split : false
					}, {
						region : 'west',
						// title : currentUser,
						title : '系统菜单',
						id : 'accordion-panel',
						layout : 'border',
						margins : '2 0 5 5',
						width : 200,
						minSize : 150,
						maxSize : 300,
						bodyStyle : 'background-color:#DFE8F6',
						defaults : {
							border : false
						},
						bbar : [{
							text : '退出系统',
							iconCls : 'icon-delete',
							handler : function() {
								Ext.Msg.confirm('操作提示', '您确定要退出本系统?', function(
										btn) {
									if ('yes' == btn) {
										/**
										 * Ext.Ajax.request({ url :
										 * '/supervise/sys/user/logout.action',
										 * success : function() {
										 * window.location.replace(window.location.href);
										 * location.replace('/supervise/sys/user/logout.action'); },
										 * failure : function() { Ext.Msg.show({
										 * title : '错误提示', msg : '退出系统失败!', icon :
										 * Ext.Msg.ERROR, buttons : Ext.Msg.OK
										 * }); } });
										 */
										window.location
												.replace(window.location.href);
										location
												.replace('/supervise/sys/user/logout.action');
									}
								});
							}
						}],
						items : [{
							id : 'supervise_menu',
							layout : 'accordion',
							region : 'center',
							items : [{
								id : 'menu_base-1',
								title : "<label class='font_menu_a'>指标设置</label>",
								border : false,
								iconCls : 'icon-nav',
								items : [{
									id : 'menu_base_goalcategory_9',
									title : "<a href=javascript:createTab('goalcategory-9') class='font_menu_b'>指标目录</a>",
									iconCls : 'icon-menu',
									border : false,
									items : [{
										id : 'menu_base_goaldetail_10',
										title : "<a href=javascript:createTab('goaldetail-10') class='font_menu_b'>指标细则管理</a>",
										iconCls : 'icon-menu',
										border : false,
										items : [{
											id : 'menu_base_orgchecksetting_11',
											title : "<a href=javascript:createTab('orgchecksetting-11') class='font_menu_b'>被考核部门指标设置</a>",
											iconCls : 'icon-menu',
											border : false
										}]
									}]
								}]
							}, {
								id : 'menu_check-2',
								title : "<label class='font_menu_a'>考核管理</label>",
								border : false,
								iconCls : 'icon-nav',
								items : [{
									id : 'menu_check_orgcheckself_15',
									title : "<a href=javascript:createTab('orgcheckself-15') class='font_menu_b'>考核指标填报</a>",
									iconCls : 'icon-menu',
									border : false,
									items : [{
										id : 'menu_check_orgcheck_16',
										title : "<a href=javascript:createTab('orgcheck-16') class='font_menu_b'>部门考核及打分</a>",
										iconCls : 'icon-menu',
										border : false,
										items : [{
											id : 'menu_check_goalself_17',
											title : "<a href=javascript:createTab('goalself-17') class='font_menu_b'>自荐指标申报</a>",
											iconCls : 'icon-menu',
											border : false,
											items : [{
												id : 'menu_check_goalselfaudit_18',
												title : "<a href=javascript:createTab('goalselfaudit-18') class='font_menu_b'>自荐指标审核</a>",
												iconCls : 'icon-menu',
												border : false
											}]
										}]
									}]
								}]
							}, {
								id : 'menu_democracy-3',
								title : "<label class='font_menu_a'>社会评价</label>",
								border : false,
								iconCls : 'icon-nav',
								items : [{
									id : 'menu_democracy_orgdemocracy_19',
									title : "<a href=javascript:createTab('orgdemocracy-19') class='font_menu_b'>社会评价考核</a>",
									iconCls : 'icon-menu',
									border : false,
									items : [{
										id : 'menu_democracy_democracygoal_12',
										title : "<a href=javascript:createTab('democracygoal-12') class='font_menu_b'>社会评价指标管理</a>",
										iconCls : 'icon-menu',
										border : false,
										items : [{
											id : 'menu_democracy_democracyscore_13',
											title : "<a href=javascript:createTab('democracyscore-13') class='font_menu_b'>社会评价指标评分类型</a>",
											iconCls : 'icon-menu',
											border : false,
											items : [{
												id : 'menu_democracy_democracycheckman_14',
												title : "<a href=javascript:createTab('democracycheckman-14') class='font_menu_b'>社会评价指标评议责任人</a>",
												iconCls : 'icon-menu',
												border : false,
												items : [{
													id : 'menu_democracy_democracygoalsetting_36',
													title : "<a href=javascript:createTab('democracygoalsetting-36') class='font_menu_b'>社会评价指标设置</a>",
													iconCls : 'icon-menu',
													border : false
												}]
											}]
										}]
									}]
								}]
							}, {
								id : 'menu_query-4',
								title : "<label class='font_menu_a'>综合查询</label>",
								border : false,
								iconCls : 'icon-nav',
								items : [{
									id : 'menu_query_progress_20',
									title : "<a href=javascript:createTab('progress-20') class='font_menu_b'>考核进展查询</a>",
									iconCls : 'icon-menu',
									border : false,
									items : [{
										id : 'menu_query_result_21',
										title : "<a href=javascript:createTab('result-21') class='font_menu_b'>考核结果查询</a>",
										iconCls : 'icon-menu',
										border : false,
										items : [{
											id : 'menu_query_democracy_22',
											title : "<a href=javascript:createTab('democracy-22') class='font_menu_b'>评议结果查询</a>",
											iconCls : 'icon-menu',
											border : false
										}]
									}]
								}]
							}, {
								id : 'menu_info-5',
								title : "<label class='font_menu_a'>信息中心</label>",
								border : false,
								iconCls : 'icon-nav',
								items : [{
									id : 'menu_info_notice_23',
									title : "<a href=javascript:createTab('notice-23') class='font_menu_b'>通知通告</a>",
									iconCls : 'icon-menu',
									border : false,
									items : [{
										id : 'menu_info_file_25',
										title : "<a href=javascript:createTab('file-25') class='font_menu_b'>相关文件</a>",
										iconCls : 'icon-menu',
										border : false,
										items : [{
											id : 'menu_info_address_26',
											title : "<a href=javascript:createTab('address-26') class='font_menu_b'>通讯录</a>",
											iconCls : 'icon-menu',
											border : false
										}]
									}]
								}]
							}, {
								id : 'menu_sys-7',
								title : "<label class='font_menu_a'>系统管理</label>",
								border : false,
								iconCls : 'icon-nav',
								items : [{
									id : 'menu_sys_org_27',
									title : "<a href=javascript:createTab('org-27') class='font_menu_b'>部门管理</a>",
									iconCls : 'icon-menu',
									border : false,
									items : [{
										id : 'menu_sys_role_28',
										title : "<a href=javascript:createTab('role-28') class='font_menu_b'>角色管理</a>",
										iconCls : 'icon-menu',
										border : false,
										items : [{
											id : 'menu_sys_user_29',
											title : "<a href=javascript:createTab('user-29') class='font_menu_b'>用户管理</a>",
											iconCls : 'icon-menu',
											border : false,
											items : [{
												id : 'menu_sys_permission_30',
												title : "<a href=javascript:createTab('permission-30') class='font_menu_b'>权限点查询</a>",
												iconCls : 'icon-menu',
												border : false,
												items : [{
													id : 'menu_sys_rolepermission_31',
													title : "<a href=javascript:createTab('rolepermission-31') class='font_menu_b'>角色权限管理</a>",
													iconCls : 'icon-menu',
													border : false,
													items : [{
														id : 'menu_sys_userrole_32',
														title : "<a href=javascript:createTab('userrole-32') class='font_menu_b'>用户角色管理</a>",
														iconCls : 'icon-menu',
														border : false
													}]
												}]
											}]
										}]
									}]
								}]
							}, {
								id : 'menu_user-8',
								title : "<label class='font_menu_a'>用户中心</label>",
								border : false,
								iconCls : 'icon-nav',
								items : [{
									id : 'menu_user_password_33',
									title : "<a href=javascript:createTab('password-33') class='font_menu_b'>密码修改</a>",
									iconCls : 'icon-menu',
									border : false,
									items : [{
										id : 'menu_user_info_34',
										title : "<a href=javascript:createTab('info-34') class='font_menu_b'>关于系统</a>",
										iconCls : 'icon-menu',
										border : false
									}]
								}]
							}]
						}]
					}, {
						id : 'content-panel',
						region : 'center',
						layout : 'card',
						margins : '2 5 5 0',
						activeItem : 0,
						border : false,
						items : [start, p_user, p_org, p_permission, p_role,
								p_role_permission, p_userrole, p_cms,
								p_goalcategory, p_democracycheckman,
								p_democracyscore, p_democracygoal,
								p_goaldetail, p_goalself, p_goalselfaudit,
								p_message, p_orgcheckself, p_orgcheck,
								p_orgdemocracy, p_orgchecksetting,
								p_user_address, p_file, p_progress, p_result,
								p_democracy, p_democracygoalsetting]
					}]
		});
	}, 250);
});
// 添加一个TAB页，采用IFRAME嵌套
function addNewTab(nameId) {
	try {
		Ext.getCmp('content-panel').layout.setActiveItem(nameId.substring(0,
				nameId.indexOf('-'))
				+ '-panel');

	} catch (e) {
	}
}
function createTab(nameId) {
	// alert(nameId);
	try {
		var panelName = nameId.substring(0, nameId.indexOf('-'));
		if (panelName == 'password') {
			editPassword();
		} else if (panelName == 'help') {
			sysHelp();
		} else if (panelName == 'info') {
			sysInfo();
		} else {
			Ext.getCmp('content-panel').layout.setActiveItem(panelName
					+ '-panel');
		}
	} catch (e) {
	}
}

function editPassword() {
	window_edit_password.show();
	if (user.userId) {
		var frm = Ext.getCmp("form_edit_password").getForm();
		frm.findField('editUerId').setValue(user.userId);
	} else {

	}
}
function sysInfo() {
	sys_info.show();
}
function sysHelp() {
	sys_help.show();
}
